Imports System.Xml.Serialization

<Serializable()> _
Public MustInherit Class Base
    Protected mlID As Long

    Protected msCreateName As String = "System"
    Protected msCreateDate As String
    Protected msChangeName As String
    Protected msChangeDate As String

    Protected mbObjectExists As Boolean = False

    Public Const Q As String = Chr(34)
    Public Const NODATA As Long = DBBase.NODATA

    Public Sub New()
        msCreateName = "System"
        msCreateDate = Now
    End Sub

    Public Sub New(ByVal lID As Long)
        mlID = lID
        msChangeName = "System"
        msChangeDate = Now

        mbObjectExists = True
    End Sub

#Region "Properties"
    <XmlIgnore()> _
    Public Property ID() As Long
        Get
            Return mlID
        End Get
        Set(ByVal value As Long)
            mlID = value
        End Set
    End Property

    <XmlIgnore()> _
    Public Property CreateName() As String
        Get
            Return msCreateName
        End Get
        Set(ByVal value As String)
            msCreateName = value
        End Set
    End Property

    <XmlIgnore()> _
    Public Property CreateDate() As String
        Get
            Return msCreateDate
        End Get
        Set(ByVal value As String)
            msCreateDate = value
        End Set
    End Property

    <XmlIgnore()> _
    Public Property ChangeName() As String
        Get
            Return msChangeName
        End Get
        Set(ByVal value As String)
            msChangeName = value
        End Set
    End Property

    <XmlIgnore()> _
    Public Property ChangeDate() As String
        Get
            Return msChangeDate
        End Get
        Set(ByVal value As String)
            msChangeDate = value
        End Set
    End Property

    <XmlIgnore()> _
    Public ReadOnly Property LastModified() As String
        Get
            If IsDate(msChangeDate) Then
                Return msChangeDate
            Else
                Return msCreateDate
            End If
        End Get
    End Property

    Public ReadOnly Property ObjectExists() As Boolean
        Get
            Return mbObjectExists
        End Get
    End Property

    Friend WriteOnly Property _ObjectExists() As Boolean
        Set(ByVal value As Boolean)
            mbObjectExists = value
        End Set
    End Property
#End Region
End Class
